package com.aaa.cs.controller;

import com.aaa.common.util.Result;
import com.aaa.cs.entity.Member;
import com.aaa.cs.entity.Order;
import com.aaa.cs.entity.Shop;
import com.aaa.cs.service.OrderService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * (Order)表控制层
 *
 * @author makejava
 * @since 2020-11-18 15:52:00
 */
@RestController
@RequestMapping("order")
public class OrderController {
    /**
     * 服务对象
     */
    @Resource
    private OrderService orderService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public Result selectOne(Integer id) {
        return this.orderService.queryById(id);
    }

    /**
     * 分页加各种条件查询
     * @param pageNo
     * @param pageSize
     * @param order
     * @return
     */
    @GetMapping("queryPageByParam")
    public Result queryPageByParam(Integer pageNo, Integer pageSize, Order order){
        return orderService.queryPageByParam(pageNo,pageSize,order);
    }

    @GetMapping("deleteById")
    public Result deleteById(Integer id){
        return orderService.deleteById(id);
    }

    @GetMapping("insertOrUpdate")
    public Result insertOrUpdate(Order order){
        return orderService.insertOrUpdate(order);
    }

    @GetMapping("queryAllMember")
    public Result queryAllMember(Member member){
        return orderService.queryAllMember(member);
    }

    @GetMapping("queryAllShop")
    public Result queryAllShop(Shop shop){
        return orderService.queryAllShop(shop);
    }
}